<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  <title>后台管理</title>
  <link rel="stylesheet" type="text/css" href="__STATIC__/admin/layui/css/layui.css" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/admin.css" />
  <style>
    .layui-form-label{ width:120px;}
    .layui-form-checkbox{ height:20px; padding-right:20px;}
    .layui-form-checkbox i{ width:20px; font-size: 12px; line-height:20px;}
    .layui-input-block{ margin-left:160px;}
    .layui-form-item .layui-form-checkbox{ margin-top:0px;}
    .rule_item{ display:block; float:left; margin-right:15px; margin-bottom:10px;}
  </style>
</head>
<body>
<div class="wrap-container">
  <form class="layui-form edit-form" method="post" action="{:url()}" style="width: 90%;padding-top: 20px;">
    {present name="info.id"}
    <input type="hidden" name="id" value="{$info.id|default=''}" />
    {/present}

    <div class="layui-form-item">
      <label class="layui-form-label">登录IP：</label>
      <div class="layui-input-block">
        <input type="text" name="ip" value="{$info.ip|default=''}" required lay-verify="required" placeholder="请输入登录IP" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">状态：</label>
      <div class="layui-input-block">
        {present name="info.id"}
        <input type="radio" name="status" value="1" title="正常" {if condition="$info.status eq 1"}checked{/if}>
        <input type="radio" name="status" value="0" title="禁用" {if condition="$info.status eq 0"}checked{/if}>
        {else /}
        <input type="radio" name="status" value="1" title="正常" checked>
        <input type="radio" name="status" value="0" title="禁用">
        {/present}
      </div>
    </div>


    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn layui-btn-normal ajax-post-btn" lay-submit lay-filter="formDemo">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>
</div>
<script src="__STATIC__/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC__/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC__/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
  //Demo
  layui.use(['form'], function() {
    var form = layui.form();
    form.render();
    //监听提交
    form.on('submit(formDemo)', function(data) {
      //layer.msg(JSON.stringify(data.field));
      ajax_post('edit-form',true,'iframe126','');
      return false;
    });


    form.on('checkbox(rules)', function(data){
      if(data.elem.checked == false){
        $(this).prop('checked',true);
      }else{
        $(this).prop('checked',false);
      }

      //console.log(data.elem.checked); //是否被选中，true或者false
      //console.log(data.value); //复选框value值，也可以通过data.elem.value得到
      //console.log(data.othis); //得到美化后的DOM对象
    });
  });

</script>


</body>
</html>